'use strict';
function make_multidimensional_to_one(collection){
  collection=(collection+"").split(",");
  collection=collection.map(function(x){
    return Number(x);
  });
  return collection;
}

function choose_no_repeat_number(collection) {
  for(let i=0;i<collection.length;i++){
    for(let j=i+1;j<collection.length;j++){
      if(collection[i]==collection[j]){
        collection.splice(j,1);
        j--;
      }
    }
  }
  return collection;
}

function double_to_one(collection) {
  let result=make_multidimensional_to_one(collection);
  result=choose_no_repeat_number(result);
  console.log(result);
  return result;
}

module.exports = double_to_one;
double_to_one([[1, 2, 3], [5, 2, 1, 4], [2, 1]]);